using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace EasyNetWork
{
    /// <summary>
    /// 网络链接成功事件
    /// </summary>
    public class NetworkConnectedEventArgs : BaseEventArgs
    {
        public static readonly int EventId = typeof(NetworkConnectedEventArgs).GetHashCode();
        
        /// <summary>
        /// 获取网络连接成功事件编号。
        /// </summary>
        public override int Id
        {
            get
            {
                return EventId;
            }
        }
        /// <summary>
        /// 获取网络频道。
        /// </summary>
        public INetworkChannel NetworkChannel
        {
            get;
            private set;
        }
        
        /// <summary>
        /// 获取用户自定义数据。
        /// </summary>
        public object UserData
        {
            get;
            private set;
        }
        
        /// <summary>
        /// 创建网络连接成功事件。
        /// </summary>
        /// <param name="networkChannel">网络频道。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>创建的网络连接成功事件。</returns>
        public static NetworkConnectedEventArgs Create(INetworkChannel networkChannel, object userData)
        {
            NetworkConnectedEventArgs networkConnectedEventArgs = new NetworkConnectedEventArgs();
            networkConnectedEventArgs.NetworkChannel = networkChannel;
            networkConnectedEventArgs.UserData = userData;
            return networkConnectedEventArgs;
        }
        
        /// <summary>
        /// 清理网络连接成功事件。
        /// </summary>
        public void Clear()
        {
            NetworkChannel = null;
            UserData = null;
        }
    }
    

}
